/**
 * @name: 数组扁平化
 * @test: test font
 * @msg:
 * @param {*} arr
 * @return {*}
 */
const flattenArr = (arr) => {
  return arr.reduce((a, b) => {
    return a.concat(
      Array.isArray(b.children) && b.children.length > 0
        ? [b, ...flattenArr(b.children)]
        : b
    )
  }, [])
}

export { flattenArr }
